package com.ssy.lingxi.member.merchant.entity;

import com.ssy.lingxi.member.merchant.handler.converter.JpaJsonToAgentAreaBOConverter;
import com.ssy.lingxi.member.merchant.model.bo.AgentAreaBO;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 会员下属渠道会员附加信息
 * @author 万宁
 * @version 2.0.0
 * @date 2020-08-26
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_channel")
public class MemberChannelDO implements Serializable {
    private static final long serialVersionUID = 3789907562701509983L;

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="member_channel_seq")
    @SequenceGenerator(sequenceName="ms_mc_member_channel_seq", name="member_channel_seq",allocationSize = 1)
    private Long id;

    /**
     * 多对一单向关联渠道类型
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "channel_type_id", referencedColumnName = "id")
    private ChannelTypeDO channelType;

    /**
     * 渠道等级
     */
    @Column(columnDefinition = "int")
    private Integer level;

    /**
     * 渠道等级名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String channelLevelTag;

    /**
     * 代理省市
     */
    @Convert(converter = JpaJsonToAgentAreaBOConverter.class)
    @Column(columnDefinition = "jsonb")
    private AgentAreaBO agentArea;

    /**
     * 渠道描述
     */
    @Column(columnDefinition = "varchar(200)")
    private String remark;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public ChannelTypeDO getChannelType() {
        return channelType;
    }

    public void setChannelType(ChannelTypeDO channelType) {
        this.channelType = channelType;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getChannelLevelTag() {
        return channelLevelTag;
    }

    public void setChannelLevelTag(String channelLevelTag) {
        this.channelLevelTag = channelLevelTag;
    }

    public AgentAreaBO getAgentArea() {
        return agentArea;
    }

    public void setAgentArea(AgentAreaBO agentArea) {
        this.agentArea = agentArea;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
